home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat2 / standard / semop.z / semop
Encoding:
Text File  |  2002-10-03  |  12.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. sssseeeemmmmoooopppp((((2222))))                                                              sssseeeemmmmoooopppp((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_eeee_mmmm_oooo_pppp - semaphore operations
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_iiii_pppp_cccc_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_eeee_mmmm_...._hhhh_>>>>
  15.  
  16.      _iiii_nnnn_tttt _ssss_eeee_mmmm_oooo_pppp_((((_iiii_nnnn_tttt _ssss_eeee_mmmm_iiii_dddd_,,,, _ssss_tttt_rrrr_uuuu_cccc_tttt _ssss_eeee_mmmm_bbbb_uuuu_ffff _****_ssss_oooo_pppp_ssss_,,,, _ssss_iiii_zzzz_eeee______tttt _nnnn_ssss_oooo_pppp_ssss_))))_;;;;
  17.  
  18. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      _ssss_eeee_mmmm_oooo_pppp is used to perform atomically an array of semaphore operations on
  20.      the set of semaphores associated with the semaphore identifier specified
  21.      by _s_e_m_i_d.  _s_o_p_s is a pointer to the array of semaphore-operation
  22.      structures.  _n_s_o_p_s is the number of such structures in the array.  The
  23.      contents of each structure includes the following members:
  24.  
  25.           _ssss_hhhh_oooo_rrrr_tttt   _ssss_eeee_mmmm______nnnn_uuuu_mmmm_;;;;    _////_**** _ssss_eeee_mmmm_aaaa_pppp_hhhh_oooo_rrrr_eeee _nnnn_uuuu_mmmm_bbbb_eeee_rrrr _****_////
  26.           _ssss_hhhh_oooo_rrrr_tttt   _ssss_eeee_mmmm______oooo_pppp_;;;;     _////_**** _ssss_eeee_mmmm_aaaa_pppp_hhhh_oooo_rrrr_eeee _oooo_pppp_eeee_rrrr_aaaa_tttt_iiii_oooo_nnnn _****_////
  27.           _ssss_hhhh_oooo_rrrr_tttt   _ssss_eeee_mmmm______ffff_llll_gggg_;;;;    _////_**** _oooo_pppp_eeee_rrrr_aaaa_tttt_iiii_oooo_nnnn _ffff_llll_aaaa_gggg_ssss _****_////
  28.  
  29.      Each semaphore operation specified by _s_e_m__o_p is performed on the
  30.      corresponding semaphore specified by _s_e_m_i_d and _s_e_m__n_u_m.
  31.  
  32.      _s_e_m__o_p specifies one of three semaphore operations as follows, depending
  33.      on whether its value is negative, positive, or zero:
  34.  
  35.      If _s_e_m__o_p is a negative integer, one of the following occurs:  {ALTER}
  36.  
  37.           If _ssss_eeee_mmmm_vvvv_aaaa_llll [see _iiii_nnnn_tttt_rrrr_oooo(2)] is greater than or equal to the absolute
  38.           value of _s_e_m__o_p, the absolute value of _s_e_m__o_p is subtracted from
  39.           _ssss_eeee_mmmm_vvvv_aaaa_llll.  Also, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is true, the absolute value of
  40.           _s_e_m__o_p is added to the calling process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value [see _eeee_xxxx_iiii_tttt(2)]
  41.           for the specified semaphore.
  42.  
  43.           If _ssss_eeee_mmmm_vvvv_aaaa_llll is less than the absolute value of _s_e_m__o_p and
  44.           (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true, _ssss_eeee_mmmm_oooo_pppp returns immediately.
  45.  
  46.           If _ssss_eeee_mmmm_vvvv_aaaa_llll is less than the absolute value of _s_e_m__o_p and
  47.           (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is false, _ssss_eeee_mmmm_oooo_pppp increments the _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt
  48.           associated with the specified semaphore and suspends execution of
  49.           the calling process until one of the following conditions occur.
  50.  
  51.              _ssss_eeee_mmmm_vvvv_aaaa_llll becomes greater than or equal to the absolute value of
  52.              _s_e_m__o_p.  When this occurs, the value of _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt associated with
  53.              the specified semaphore is decremented, the absolute value of
  54.              _s_e_m__o_p is subtracted from _ssss_eeee_mmmm_vvvv_aaaa_llll and, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is
  55.              true, the absolute value of _s_e_m__o_p is added to the calling
  56.              process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value for the specified semaphore.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. sssseeeemmmmoooopppp((((2222))))                                                              sssseeeemmmmoooopppp((((2222))))
  71.  
  72.  
  73.  
  74.              The _s_e_m_i_d for which the calling process is awaiting action is
  75.              removed from the system [see _ssss_eeee_mmmm_cccc_tttt_llll(2)].  When this occurs, _eeee_rrrr_rrrr_nnnn_oooo
  76.              is set equal to _EEEE_IIII_DDDD_RRRR_MMMM, and a value of -1 is returned.
  77.  
  78.              The calling process receives a signal that is to be caught.  When
  79.              this occurs, the value of _ssss_eeee_mmmm_nnnn_cccc_nnnn_tttt associated with the specified
  80.              semaphore is decremented, and the calling process resumes
  81.              execution in the manner prescribed in _ssss_iiii_gggg_nnnn_aaaa_llll(2).
  82.  
  83.      If _s_e_m__o_p is a positive integer, the value of _s_e_m__o_p is added to _ssss_eeee_mmmm_vvvv_aaaa_llll
  84.      and, if (_s_e_m__f_l_g_&&&&_SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO) is true, the value of _s_e_m__o_p is subtracted
  85.      from the calling process's _ssss_eeee_mmmm_aaaa_dddd_jjjj value for the specified semaphore.  -
  86.      {ALTER}
  87.  
  88.      If _s_e_m__o_p is zero, one of the following occurs:  {READ}
  89.  
  90.           If _ssss_eeee_mmmm_vvvv_aaaa_llll is zero, _ssss_eeee_mmmm_oooo_pppp returns immediately.
  91.  
  92.           If _ssss_eeee_mmmm_vvvv_aaaa_llll is not equal to zero and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true,
  93.           _ssss_eeee_mmmm_oooo_pppp returns immediately.
  94.  
  95.           If _ssss_eeee_mmmm_vvvv_aaaa_llll is not equal to zero and (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is false,
  96.           _ssss_eeee_mmmm_oooo_pppp increments the _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt associated with the specified semaphore
  97.           and suspends execution of the calling process until one of the
  98.           following occurs:
  99.  
  100.              Semval becomes zero, at which time the value of _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt
  101.              associated with the specified semaphore is decremented.
  102.  
  103.              The _s_e_m_i_d for which the calling process is awaiting action is
  104.              removed from the system.  When this occurs, _eeee_rrrr_rrrr_nnnn_oooo is set equal to
  105.              _EEEE_IIII_DDDD_RRRR_MMMM, and a value of -1 is returned.
  106.  
  107.              The calling process receives a signal that is to be caught.  When
  108.              this occurs, the value of _ssss_eeee_mmmm_zzzz_cccc_nnnn_tttt associated with the specified
  109.              semaphore is decremented, and the calling process resumes
  110.              execution in the manner prescribed in _ssss_iiii_gggg_nnnn_aaaa_llll(2).
  111.  
  112.      _ssss_eeee_mmmm_oooo_pppp fails if one or more of the following are true for any of the
  113.      semaphore operations specified by _s_o_p_s:
  114.  
  115.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _s_e_m_i_d is not a valid semaphore identifier.
  116.  
  117.      _EEEE_FFFF_BBBB_IIII_GGGG          _s_e_m__n_u_m is less than zero or greater than or equal to the
  118.                     number of semaphores in the set associated with _s_e_m_i_d.
  119.  
  120.      _EEEE_2222_BBBB_IIII_GGGG          _n_s_o_p_s is greater than the system-imposed maximum.
  121.  
  122.      _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS         Operation permission is denied to the calling process [see
  123.                     _iiii_nnnn_tttt_rrrr_oooo(2)].
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. sssseeeemmmmoooopppp((((2222))))                                                              sssseeeemmmmoooopppp((((2222))))
  137.  
  138.  
  139.  
  140.      _EEEE_AAAA_GGGG_AAAA_IIII_NNNN         The operation would result in suspension of the calling
  141.                     process but (_s_e_m__f_l_g_&&&&_IIII_PPPP_CCCC______NNNN_OOOO_WWWW_AAAA_IIII_TTTT) is true.
  142.  
  143.      _EEEE_NNNN_OOOO_SSSS_PPPP_CCCC         The limit on the number of individual processes requesting
  144.                     an _SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO would be exceeded.
  145.  
  146.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         The number of individual semaphores for which the calling
  147.                     process requests a _SSSS_EEEE_MMMM______UUUU_NNNN_DDDD_OOOO would exceed the limit.
  148.  
  149.      _EEEE_RRRR_AAAA_NNNN_GGGG_EEEE         An operation would cause a _ssss_eeee_mmmm_vvvv_aaaa_llll to overflow the system-
  150.                     imposed limit.
  151.  
  152.      _EEEE_RRRR_AAAA_NNNN_GGGG_EEEE         An operation would cause a _ssss_eeee_mmmm_aaaa_dddd_jjjj value to overflow the
  153.                     system-imposed limit.
  154.  
  155.      _EEEE_FFFF_AAAA_UUUU_LLLL_TTTT         _s_o_p_s points to an illegal address.
  156.  
  157.      _EEEE_IIII_DDDD_RRRR_MMMM          A _s_e_m_i_d referenced by the call was removed from the
  158.                     system.
  159.  
  160.      Other errors which can occur on _ssss_eeee_mmmm_oooo_pppp are:
  161.  
  162.      _EEEE_IIII_NNNN_TTTT_RRRR          _ssss_eeee_mmmm_oooo_pppp(2) was interrupted by a signal.
  163.  
  164.      Upon successful completion, the value of _ssss_eeee_mmmm_pppp_iiii_dddd for each semaphore
  165.      specified in the array pointed to by _s_o_p_s is set equal to the process ID
  166.      of the calling process.
  167.  
  168. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  169.      _iiii_nnnn_tttt_rrrr_oooo(2), _eeee_xxxx_eeee_cccc(2), _eeee_xxxx_iiii_tttt(2), _ffff_oooo_rrrr_kkkk(2), _ssss_eeee_mmmm_cccc_tttt_llll(2), _ssss_eeee_mmmm_gggg_eeee_tttt(2).
  170.  
  171. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  172.      If _s_e_m_o_p returns due to the receipt of a signal, a value of -1 is
  173.      returned to the calling process and _eeee_rrrr_rrrr_nnnn_oooo is set to _EEEE_IIII_NNNN_TTTT_RRRR.  If it returns
  174.      due to the removal of a _s_e_m_i_d from the system, a value of -1 is returned
  175.      and _eeee_rrrr_rrrr_nnnn_oooo is set to _EEEE_IIII_DDDD_RRRR_MMMM.
  176.  
  177.      Upon successful completion, a value of zero is returned.  Otherwise, a
  178.      value of -1 is returned and _eeee_rrrr_rrrr_nnnn_oooo is set to indicate the error.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.